Repository navigation
Speed up the timeline's frames around its kept rows, and say why they aren't #[Memo] - #187
Merged
Merged
Conversation
1 task done
simonhamp
marked this pull request as ready for review
November 25, 2026 11:32
With pastéis mode off, the screen passes $pasteis as null, and both RowInputs::for() and commit-actions treated null as "not given" and asked the account again. That's a query on the phone, where the cache is the app's SQLite database, so every row on the Log cost one on every frame, kept or not: 24 queries a frame on a log of 20. Null is now an answer. The account is only asked when the screen passed nothing at all. The same goes for $viewer, which is null when you're signed out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every frame built the rows around the commits afresh: the skeleton rows of a log or tab with nothing loaded, the loading row at the end of a list, the root commit row, the day markers and the last-visit marker, and a profile's pinned commit. On the Log that was five skeleton and loading rows on every frame, about a third of a frame where nothing changed. They now go through the list's RowCache like its commits, on the Log, profiles, organizations, Starred and Search. Each is kept against what it draws, so a loading row that stops pulsing when you swipe away is built again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every frame read the answer kept for the log beside yours and made its first commits afresh, with their bodies parsed again. New commits then missed the timeline laid out for them last frame and the rows kept for them, so each was hashed again too. The preview is now kept with a hash of what it was made from, and only made again when that changes, as it does when a star or a delete reaches the kept answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A poll you can vote on draws its Vote button in your lane colour, which the row reads from the screen. RowInputs didn't have it, so after you changed your colour the Log kept the old one on that button until the row changed for some other reason. The kept-row test now also changes your colour and joins you to an organization whose commit is showing, and checks the kept rows against rows built afresh, as it did for stars, times and threads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RowInputs kept every row against the whole list of stashed drafts and unfolded commits, though a row only shows its own: a dot on its Quote or Reply button, and its body whole once you tapped Show more. Starting a draft anywhere, as the first letter of a quote or a reply does, built every row on the screen again. Each row is now kept against its own drafts and its own unfolding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The commit a page is about, what it replies to, the rest of its series and the related commits were built again on every frame. Typing a reply draws a frame a few times a second, so each letter built every commit above the reply bar. They now go through the page's RowCache with its replies. The commit the page is about is also kept against what it shows of its thread (whether its replies are open, and how many) and your timezone, which its time's label is in. The test changes each of those, and the time, and checks the kept rows against rows built afresh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since #187 was started, main's commit page grew a few ways for a commit row to change without its commit changing: the replies of a commit above it open and fold in place, tapping a commit in the tree moves the page to it, and an author's replies to themselves read as a thread under the commit. Each of these now gets the same check as the rest: the kept rows must match rows built afresh. That covers an ancestor's replies opening, fading out and folded, the page moving up, back down and down to a reply, and a self thread with its replies opened and closed, the time passing and the page moving to a later part. Typing a reply still only builds the commit it replies to, once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CachedRow sent its kept node in full every frame, so with EDGE's subtree reuse on, a list whose rows are kept still went out whole whenever any row changed. It now builds a row against no hashes, so the kept node is always whole, and sends it the way EDGE's own walk sends a node: a reuse marker for any part the phone holds by id and hash, the rest in full. Nothing changes while a screen sets $forceFullFrames, because the hashes start empty every frame there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Log sent every frame in full because EDGE's subtree reuse could refer to rows the phone never got, which drew the list blank after a pull to refresh. That is fixed in nativephp/mobile by NativePHP/mobile-air#699: the reader parses every frame instead of dropping some, a row's id is part of its hash, and a reader that still can't build a frame asks PHP for a full one. With that, a star on a 60 commit Log sends about 9 KB instead of 530 KB. This needs that fix. On mobile-air 4.8.0 without it, the Log goes blank again, so the new test skips itself there. The test replays every frame the way the phone's reader does and checks the result against a full frame after each step: a star, a thread, the next page, new commits on top, back to the top, a delete from the middle, the pill, the image viewer and a swipe to another log and back. The other screens that set the flag no longer point at the Log's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A profile went in full so that a tab tapped again, which puts the same rows in a list with a new key, still reached the phone. With a row's id in its hash (NativePHP/mobile-air#699), the new list no longer matches the old one, so it is sent as it should be. The test covers a star, a thread, the tab tapped again, and a swipe to Replies and back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An organization's page is built like a profile's and went in full for the same reason: a tab tapped again puts the same rows in a list with a new key. That reaches the phone now (NativePHP/mobile-air#699). The test covers a star, a thread, the tab tapped again, and a swipe to Mentions and back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tap into the reply field mounts the thread's scroll view again under a new key, and subtree reuse then pointed at rows the phone had dropped, so the thread went blank as you started typing. The new key now changes the scroll view's hash (NativePHP/mobile-air#699), so it goes out whole, and each letter typed after that sends only the reply bar. The test opens the earlier commits and the replies, taps into the field twice, and types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Starred went in full because rows leave its list from the middle. The rows are keyed, so the frame after an unstar refers to the rows that stay by id, and with the reader parsing every frame (NativePHP/mobile-air#699) the phone has all of them. The test unstars rows from the middle and the top, with a thread open under one of them, and pulls to refresh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Notifications went in full for the same reason as the Log: subtree reuse could refer to rows the phone never got and draw the list blank. Those were frames the phone's reader dropped, which it no longer does (NativePHP/mobile-air#699). The test opens a group, brings two new notifications in on top, loads the next page, closes the group and turns every kind back on, which puts the list under a new key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remotes went in full because a conversation with a new message moves to the top. Its rows are keyed, so the move refers to them by id, and the tab tapped again now reaches the phone as a new list (NativePHP/mobile-air#699). The test moves two conversations to the top from the middle and lower down, taps the tab again, swipes to Fetched and back, and checks the order the phone ends up with. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Search went in full because a new term replaces every row. New rows are new ids, which go out in full anyway, and rows a term shares with the last one are referred to by id, which the phone now always holds (NativePHP/mobile-air#699). The test picks a term, types more of it, switches to a term with the same commits in another order, goes back, and clears the field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A thread went in full because messages come in at the bottom and their reactions change in place. Both are ordinary changes to keyed rows, and the frames that carried them are no longer dropped by the phone's reader (NativePHP/mobile-air#699). The test polls in a message and a reaction, types, hearts a message, replies and sends, loads older messages above, and polls again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The commit page's commits are now kept between frames and sent as reuse markers where the phone holds them. On main the page also moves to another commit in its tree without a new scroll view, and the commits above open their replies in place. The partial frames case for the commit page now moves up to the parent, opens and folds the root's replies, moves back down and then down to a reply, and checks the phone's tree against a full frame after each step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
simonhamp
force-pushed
the
perf/memo-timeline-rows
branch
from
November 25, 2026 12:20
3acacc1 to
a4f7fcf
Compare
simonhamp
changed the base branch from
integration/timeline-memo-base
to
main
November 25, 2026 12:20
simonhamp
added a commit
that referenced
this pull request
Nov 25, 2026
Main's commit page kept replyTapped() and the scroll view's $scrollKey, and gained a lot around them: moving the page around its tree, animated scrolls, and #187's partial frames. This keeps all of that and still drops the jump. $scrollKey and replyTapped() go, the scroll view's key is plain "thread", and the reply field has no press handler. PartialFramesTest loses its two steps that tapped the reply field, since the tap no longer does anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is on
mainnow. It was based onintegration/timeline-memo-base, and all ten PRs in that branch have merged. Main's commit page builds its rows inCommitDetail::pageRows(), so the commit page's row caching was redone for that.Why the rows aren't
#[Memo]componentsThe question was whether the Log and profile rows use
#[Memo]from mobile-air 4.8. They don't, and they shouldn't. Since #40 they go throughApp\Devnull\RowCache, which already does what Memo does and a bit more: it keeps each row's elements and the node it sent, against a hash of what the row shows, so an unchanged row costs one hash a frame.I turned the feed's commit and reply rows into a
#[Memo]child component on mobile-air 4.8.0 and timed both on the same data. Memo was slower on every step:#[Memo]Two reasons. The Log, profiles, Search and Starred send every frame in full (
$forceFullFrames), and Memo's shortcut is a reuse marker that only works with subtree reuse on, so it walks and serialises every kept row again each frame.CachedRowskips that walk. And Memo compares a child's props every frame by serialising any object among them, which here is theCommit, whereRowCachehashes each readonly commit once. So the rows stay where they are and this PR goes after the rest of each frame. The prototype isn't in this PR. Those timings were taken before #189 was merged into this branch and turned full frames off.What changed
$viewertoo.RowCachewith its commits, on the Log, profiles, organizations, Starred and Search. On the Log that was five rows on every frame.RowCachelike its replies. That's every commit rowpageRows()gives (the commits above, the commit, its series and its author's thread) and the related commits. Typing a reply used to build all of them on every frame. The focused commit is also kept against whether its replies are open, its reply count and your timezone.RowInputsdidn't cover, so after changing your colour the Log kept the old one on that button.$forceFullFramesoff on the timeline screens, andCachedRowsends a kept row as reuse markers where the phone already holds it. Its own PR has the details and numbers.Every frame should be the same as before. Before the move, the bench below recorded the tree each step ends on, and all 336 of them matched the old base branch's, node for node: about 204 KB a frame on a Log of 20 commits and 530 KB with 60, measured as the tree's JSON, before #189. On main, the kept-row tests check every kept row against one built afresh, and
PartialFramesTestchecks the phone's tree against a full frame after each step.Numbers
All of these were measured before the move, against
integration/timeline-memo-baseand without #189. The bench isn't in this repo, so they haven't been re-run on main.Mac, PHP only (render plus
toArray, median of 11 runs, same fixtures, cache in SQLite and kept answers in files as on a phone):On an iOS 27 simulator and an Android 15 emulator, a debug build of each side ran a scripted session against a fake API serving the same fixtures, one step every 1.5 s, timed from mobile-air's own
PERFlines inedge-nav.log. This is the frame each step caused, render plustoArray, median of five runs:First renders barely move on either: building a row costs about the same as before (about 1 ms each on a Mac), and that's most of a first render.
The bench, the timing harness and the fake API aren't in this PR. They're attached to the board entry for this task, with how to run them.
What to watch for
RowInputsis the contract: anything a row partial reads from its screen has to be in it, or a kept row shows what it showed before. The tests inLogRowCacheTestandRowCacheScreensTestnow change a star, the time, your timezone, your colour, your organizations, a draft, Show more and a thread's state, and check kept rows against rows built afresh. A partial that starts reading something new needs adding there too.On the commit page the rows come from
CommitDetail::pageRows(). A commit row's data says where it sits in the tree: its rail, its place in its author's thread, and an ancestor's reply count.RowInputssays whether an ancestor's replies are open. The commit the page is about also reads its replies' state and your timezone from the page, so those are in its inputs as well (commit-detail.blade.php). The tests fail if either is taken out. They now also open and fold the replies of a commit above, move the page up, down and onto a reply, and walk a self thread.PartialFramesTest's commit page case moves the page around its tree too.Full suite on main: 2304 passed, 12 skipped. The skips are the nine edge blur tests, two that need NativePHP/mobile-air#736, and one that only runs without core's menu row subtitles.
Not done here
Account::user()asked again from several places. Remembering it for a frame would cut most of them, but background tasks read the same keys from another runtime, so it needs care.commit-actionsandcommit-row-contentmost of it. That's what first renders, next pages and opening threads pay for. Fewer nodes per row is the lever there.#[Memo]to help a list in mobile-air, a memoised child would need to keep its serialised node on full-frame screens, asCachedRowdoes, and compare object props without serialising them every frame.Screenshots
Nothing a user sees changed. Before the move every frame matched the base branch's, and on main the kept rows match rows built afresh. Checked by hand before the move on an iOS simulator and an Android emulator in light and dark: starring, opening and closing threads, the quote sheet, next pages, pull to refresh, a profile's tabs, and a commit page's replies and reply bar all update as before.
🤖 Generated with Claude Code